package cn.com.anypay.manager.payment.core;

/**
 * 支付异常类
 *
 * 用于处理支付过程中的各种异常情况
 *
 * @author AnyPay Team
 * @version 1.0
 * @since 2025-07-05
 */
public class PaymentException extends Exception {

    private static final long serialVersionUID = 1L;

    /**
     * 错误代码
     */
    private String errorCode;

    /**
     * 错误详情
     */
    private String errorDetail;

    /**
     * 渠道标识
     */
    private String channelId;

    public PaymentException() {
        super();
    }

    public PaymentException(String message) {
        super(message);
    }

    public PaymentException(String message, Throwable cause) {
        super(message, cause);
    }

    public PaymentException(String errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
    }

    public PaymentException(String errorCode, String message, String channelId) {
        super(message);
        this.errorCode = errorCode;
        this.channelId = channelId;
    }

    public PaymentException(String errorCode, String message, String errorDetail, String channelId) {
        super(message);
        this.errorCode = errorCode;
        this.errorDetail = errorDetail;
        this.channelId = channelId;
    }

    public PaymentException(String errorCode, String message, Throwable cause, String channelId) {
        super(message, cause);
        this.errorCode = errorCode;
        this.channelId = channelId;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorDetail() {
        return errorDetail;
    }

    public void setErrorDetail(String errorDetail) {
        this.errorDetail = errorDetail;
    }

    public String getChannelId() {
        return channelId;
    }

    public void setChannelId(String channelId) {
        this.channelId = channelId;
    }

    @Override
    public String toString() {
        return "PaymentException{" +
                "errorCode='" + errorCode + '\'' +
                ", errorDetail='" + errorDetail + '\'' +
                ", channelId='" + channelId + '\'' +
                ", message='" + getMessage() + '\'' +
                '}';
    }
}